home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Tools / Preditor 2.0 / Preditor Folder / PCMD Source / Think C / Enumerate.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-04  |  1.0 KB  |  55 lines  |  [TEXT/TCEd]

  1. /************************************************************
  2.  
  3.     Enumerate.c
  4.     Last Modified: Friday, May 31, 1991 at 9:46 PM
  5.     
  6.     Convert a string to a C version of the string
  7.  
  8.     © Copyright Evatac Software  1988-1990
  9.     All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13. #include "PCMD.h"
  14. #include <PackageMgr.h>
  15. #include <MemoryMgr.h>
  16. #include <pascal.h>
  17.  
  18. typedef struct MyGlobals {
  19.     short        count;
  20. } MyGlobals;
  21.  
  22. main(
  23.     unsigned char        *sourceText,
  24.     long                sourceLength,
  25.     unsigned char        *destText,
  26.     long                *destSpace,
  27.     PCMDInfo            *info
  28.     )
  29. {
  30.     MyGlobals    *globals;
  31.     short        length;
  32.  
  33.     if (sourceLength + 5 > *destSpace)
  34.         return(kPCMDMoreSpace);
  35.         
  36.     globals    = (MyGlobals *) info->globals;
  37.  
  38.     if (FirstLine(info))
  39.         globals->count = 0;
  40.     globals->count++;
  41.     
  42.     NumToString(globals->count, destText);
  43.     length = (short) *destText;
  44.     PtoCstr((char *)destText);
  45.     destText += length;
  46.     *(destText++) = '.';
  47.     *(destText++) = 9;
  48.     
  49.     BlockMove(sourceText, destText, sourceLength);
  50.     *destSpace = sourceLength + length + 2;
  51.     
  52.     return(kPCMDSuccess);
  53. }
  54.  
  55.